#include"person.pb.h"
#include<string>
#include<iostream>

int main(){
  
    Person::Person p1;
    p1.set_age(1);
    p1.set_name("张三");

     std::string s;
  bool ok=  p1.SerializeToString(&s);

if(!ok) std::cout<<"序列化错误"<<std::endl;

  std::cout<<"序列化结果： "<<s<<std::endl;
    Person::Person p2;

    p2.ParseFromString(s);

    std::cout<<"name: "<<p2.name()<<std::endl;
    std::cout<<"age: "<<p2.age()<<std::endl;
    return 0;
}


